/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.hpvas.persistence.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author raider
 */
@Entity
@Table(name = "Vaccine")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vaccine.findAll", query = "SELECT v FROM Vaccine v"),
    @NamedQuery(name = "Vaccine.findById", query = "SELECT v FROM Vaccine v WHERE v.id = :id"),
    @NamedQuery(name = "Vaccine.findByDosage", query = "SELECT v FROM Vaccine v WHERE v.dosage = :dosage")})
public class Vaccine implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    @Lob
    @Column(name = "name")
    private String name;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "dosage")
    private Float dosage;
    @JoinColumn(name = "idMedicalRecord", referencedColumnName = "id")
    @ManyToOne
    private MedicalRecord idMedicalRecord;

    public Vaccine() {
    }

    public Vaccine(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Float getDosage() {
        return dosage;
    }

    public void setDosage(Float dosage) {
        this.dosage = dosage;
    }

    public MedicalRecord getIdMedicalRecord() {
        return idMedicalRecord;
    }

    public void setIdMedicalRecord(MedicalRecord idMedicalRecord) {
        this.idMedicalRecord = idMedicalRecord;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vaccine)) {
            return false;
        }
        Vaccine other = (Vaccine) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Vaccine[ id=" + id + " ]";
    }
    
}
